package com.example.mobile2121606110syc0328;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private EditText editTextTextPersonName3;
    private EditText editTextTextPersonName4;
    private Button button;
    private EditText editTextTextPersonName5;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String num1=editTextTextPersonName3.getText().toString();
                String num2=editTextTextPersonName4.getText().toString();
                int a=Integer.valueOf(num1);
                int b=Integer.valueOf(num2);
                int result=a+b;
                editTextTextPersonName5.setText(String.valueOf(result));
            }
        });
    }

    private void initView() {
        editTextTextPersonName3 = (EditText) findViewById(R.id.editTextTextPersonName3);
        editTextTextPersonName4 = (EditText) findViewById(R.id.editTextTextPersonName4);
        button = (Button) findViewById(R.id.button);
        editTextTextPersonName5 = (EditText) findViewById(R.id.editTextTextPersonName5);
    }
}